package com.apes.auto.maintain.service;

import com.apes.auto.maintain.model.MaintainPeriod;
import com.apes.auto.maintain.repository.MaintainPeriodRepository;
import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName MaintainPeriodService
 * @Description TODO
 * @Author pengyb
 * @Date 2019/8/9 9:46
 * @Version 1.0
 **/
@Service("maintainPeriodService")
public class MaintainPeriodService extends DomainService {
    @Autowired
    private MaintainPeriodRepository maintainPeriodRepository;

    public MaintainPeriod save(SimpleRequest request) {
        MaintainPeriod o = request.getO(MaintainPeriod.class);
        return maintainPeriodRepository.saveAndFlush(o);
    }

    public String delete(SimpleRequest request) {
        MaintainPeriod o = request.getO(MaintainPeriod.class);
        maintainPeriodRepository.delete(o);
        return "删除成功";
    }
}
